<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>添加链接</title>
    <script src="https://cdn.jsdelivr.net/npm/vue@2/dist/vue.js"></script>
    <script src="https://unpkg.com/axios/dist/axios.js"></script>

</head>
<body>
<h1>添加链接</h1>
<div id="app">
<label>名称</label><input type="text" v-model="flable" placeholder="请输入链接名称"><br>
<label>链接</label><input type="text" v-model="furl" placeholder="请输入链接地址"><br>
<label>描述</label><input type="text" v-model="fdesc" placeholder="请输入链接描述"><br>
<label>标签</label><input type="text" v-model="ftags" placeholder="请输入链接所属标签"><br>
<button @click.prevent="save">保存</button>
</div>

<script>
    let v = new Vue({
        el : "#app",
        data : {
            flable : "",
            furl : "",
            fdesc : "",
            ftags : ""
        },
        methods : {
            save() {
                var params = new URLSearchParams();
                params.append("flable", this.flable);
                params.append("furl",this.furl);
                params.append("fdesc",this.fdesc);
                params.append("ftags",this.ftags);
                axios.post("addFav.s",params).then(res =>{
                    alert(res.data.msg);
                    if(res.data.code == 0) {

                    } else {
                        // 关闭窗口
                        window.close();
                    }
                })
            }
        }

    })
</script>
</body>
</html>